// src/com/q18/jenkins/EnvUtils.groovy

package com.q18.jenkins

public class EnvUtils {
    public static String getEnv(def script, String key, String defaultValue = null) {
        script.echo "[ShareLib] (src/) 获取环境变量 '${key}'"
        return script.env."${key}" ?: defaultValue
    }

    public static void setEnv(def script, String key, String value) {
        script.echo "[ShareLib] (src/) 设置环境变量 '${key}': '${value}'"
        script.env."${key}" = value
        return value
    }
}